package com.kgc.fallback;//package com.kgc.fallback;

import com.kgc.pojo.Product;
import com.kgc.pojo.User;
import com.kgc.remote.ProductRemote;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@Component
public class ProductRemoteFallBack implements ProductRemote {

    @Override
    public Product getProductById(@RequestParam Integer productId,
                                  @RequestBody User user) {
        System.out.println("进入熔断处理.....ProductRemoteFallBack");
        System.out.println("熔断器Hystrix接收的参数productId："+productId);
        System.out.println("熔断器Hystrix接收的参数user："+user);

        Product product = new Product(productId,"商品未获取到",0.0);
        return product;
    }

//    @Override
//    public String getProductById(@RequestParam Integer productId,User user
//                                 ) {
//        System.out.println("进入熔断处理.....ProductRemoteFallBack");
//        System.out.println("熔断器Hystrix接收的参数productId："+productId);
//
//
//
//        return productId+"商品未获取到";
//    }
}
